class Solution
{
public:
    vector<int> circularGameLosers(int n, int k)
    {
        vector<bool> got(n, false);
        int pos = 0;
        int i = 1;
        while (true)
        {
            if (got[pos])
            {
                break;
            }
            got[pos] = true;
            pos = (pos + i * k) % n;
            ++i;
        }

        vector<int> result;
        for (int j = 0; j < n; ++j)
        {
            if (!got[j])
            {
                result.push_back(j + 1);
            }
        }
        return result;
    }
};